/*
* created by Administrator on 2018/12/3
* 好的代码像粥一样,是得用时间和精力熬的。
*/

/*function Person(name, age, gender) {
    this.name = name;
    this.age = age;
    this.gender = gender;
}
Person.prototype = {
    constructor:Person,
    sing:function() {
        console.log('i am singing');
    },
    eat:function() {
        console.log('meat');
    }
}

var a = new Person('marry', 20, false);*/



/*es6的写法*/
class Person {
    constructor (name, age, gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }
    sing() {
        console.log('i am singing');
    }
    eat() {
        console.log('meat');
    }
}

let c = new Person('marry', 20, false);
c.sing();